﻿CREATE TABLE [dbo].[t_Repossession] (
    [ID]            INT           IDENTITY (1, 1) NOT NULL,
    [LoanID]        INT           NOT NULL,
    [StatusID]      INT           NOT NULL,
    [StatusDate]    DATETIME      NOT NULL,
    [StatusUser]    VARCHAR (32)  NOT NULL,
    [AgentUserName] NVARCHAR (64) NULL,
    [IsInRepo]      AS            (case [StatusID] when [dbo].[fs_StateID__Repo__NoRepo]() then (0) else (1) end) PERSISTED NOT NULL,
    [DateActive]    SMALLDATETIME NULL
);


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = NULL, @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N't_Repossession', @level2type = N'COLUMN', @level2name = N'StatusDate';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Date when repo process was initiated', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N't_Repossession', @level2type = N'COLUMN', @level2name = N'DateActive';

